package huixue.cn.com.rxapp;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import rx.Subscriber;
import rx.functions.Func0;

/**
 * Created by gongdongyang on 2018/8/8.
 */

public class Test {
    static  String valueStr ="";
    public static void main(String[] args) {
        System.out.println("========");
        /*Observable observable = Observable.defer(new Func0<ObservableSource<String>>() {
            @Override
            public ObservableSource<String> call() {
                return Observable.just(valueStr);
            }
        });*/
        Observable observable =  Observable.just(valueStr);
        valueStr = "深入浅出RxJava与Android";

        observable.subscribe(new Observer<String>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(String o) {
                System.out.println(o);
            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onComplete() {
            }
        });

    }




}
